package seatiger.tomcat.catalina.startup;

import org.apache.commons.digester.Rule;
import org.xml.sax.Attributes;
import seatiger.tomcat.catalina.connector.CoyoteConnector;
import seatiger.tomcat.catalina.connector.HttpConnector;

/**
 * 创建CoyoteConnector
 */
public class CoyoteConnectorCreateRule extends Rule {

    @Override
    public void begin(Attributes attributes) throws Exception {
        String protocol = attributes.getValue("protocol");
        if ("old_protocol".equals(protocol)) {
            digester.push(new HttpConnector());
        }else{
            digester.push(new CoyoteConnector(protocol));
        }
    }

    @Override
    public void end() throws Exception {
        Object top = digester.pop();
    }
}
